package com.example.test.mapper;

import com.example.test.bean.DTO.output.OrderGoodsListOutputDTO;
import com.example.test.bean.OrderGoods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单所含商品表 Mapper 接口
 * </p>
 *
 * @author dz
 * @since 2022-04-11
 */
@Mapper
public interface OrderGoodsMapper extends BaseMapper<OrderGoods> {
    //根据order_id查询
    @Select("SELECT\n" +
            "\torder_id,\n" +
            "\tgoods_id,\n" +
            "\tgoods_name,\n" +
            "\tgood_num,\n" +
            "\tsell_price,\n" +
            "\tsum_sell,\n" +
            "\tis_enough\n" +
            "FROM\n" +
            "\torder_goods\n" +
            "WHERE\n" +
            "\torder_id = #{orderId}\n")
    List<OrderGoodsListOutputDTO> getoGoodsById(Long orderId);
}
